Telegram Group & Telegram Channel
Can't step through code in VS Code + OpenOCD + GDB with RISC-V — everything connects but stepping doesn't work


Hi! I'm setting up debugging for a RISC-V project in VS Code using the Cortex-Debug extension. I'm using OpenOCD and `riscv32-unknown-elf-gdb`. The configuration seems to launch correctly: OpenOCD starts, GDB connects, and the ELF file (`main.elf`) is loaded. A breakpoint in `main()` also sets successfully.

But then I run into problems:

* After `exec-continue`, the program stops at `0x00010058 in ?? ()`.
* The breakpoint in `main()` doesn’t hit, and I can’t step through the code (step over / step into doesn’t work).
* `main()` is at `0x400000c0`, and the ELF is built with `-g`, but something is clearly off.

# What I’ve checked:

* `"showDevDebugOutput": "parsed"` is set
* The ELF file contains debug symbols (verified with `nm`, `objdump`)
* Using custom `riscv.cfg` and my own `startup.S`
* Using `riscv32-unknown-elf-gdb` and OpenOCD listening on `localhost:50000`
* `readelf` shows the entry point does **not** match the address of `main()`

launch.json

{
"configurations": [
{
"name": "RISCV",
"type": "cortex-debug",
"request": "launch",
// "showDevDebugOutput": "parsed",
"servertype": "openocd",
"cwd": "${workspaceFolder}",
"executable": "./build/main.elf",
"gdbTarget": "localhost:50000",
"configFiles": [
"lib/riscv.cfg"
],
"postLaunchCommands": [
"load"
],
"runToEntryPoint": "main"
}
]
}

settings.json

{
"cortex-debug.openocdPath": "/usr/bin/openocd",
"cortex-debug.variableUseNaturalFormat": true,
"cortex-debug.gdbPath": "/home/riscv/bin/riscv32-unknown-elf-gdb",
"search.exclude": {
"**/build": true
},
"files.associations": {
"printf_uart.h": "c"
}
}

https://redd.it/1kr1rao
@r_riscv



tg-me.com/r_riscv/3338
Create:
Last Update:

Can't step through code in VS Code + OpenOCD + GDB with RISC-V — everything connects but stepping doesn't work


Hi! I'm setting up debugging for a RISC-V project in VS Code using the Cortex-Debug extension. I'm using OpenOCD and `riscv32-unknown-elf-gdb`. The configuration seems to launch correctly: OpenOCD starts, GDB connects, and the ELF file (`main.elf`) is loaded. A breakpoint in `main()` also sets successfully.

But then I run into problems:

* After `exec-continue`, the program stops at `0x00010058 in ?? ()`.
* The breakpoint in `main()` doesn’t hit, and I can’t step through the code (step over / step into doesn’t work).
* `main()` is at `0x400000c0`, and the ELF is built with `-g`, but something is clearly off.

# What I’ve checked:

* `"showDevDebugOutput": "parsed"` is set
* The ELF file contains debug symbols (verified with `nm`, `objdump`)
* Using custom `riscv.cfg` and my own `startup.S`
* Using `riscv32-unknown-elf-gdb` and OpenOCD listening on `localhost:50000`
* `readelf` shows the entry point does **not** match the address of `main()`

launch.json

{
"configurations": [
{
"name": "RISCV",
"type": "cortex-debug",
"request": "launch",
// "showDevDebugOutput": "parsed",
"servertype": "openocd",
"cwd": "${workspaceFolder}",
"executable": "./build/main.elf",
"gdbTarget": "localhost:50000",
"configFiles": [
"lib/riscv.cfg"
],
"postLaunchCommands": [
"load"
],
"runToEntryPoint": "main"
}
]
}

settings.json

{
"cortex-debug.openocdPath": "/usr/bin/openocd",
"cortex-debug.variableUseNaturalFormat": true,
"cortex-debug.gdbPath": "/home/riscv/bin/riscv32-unknown-elf-gdb",
"search.exclude": {
"**/build": true
},
"files.associations": {
"printf_uart.h": "c"
}
}

https://redd.it/1kr1rao
@r_riscv

BY RISC-V Reddit




Share with your friend now:
tg-me.com/r_riscv/3338

View MORE
Open in Telegram


RISC V Reddit Telegram | DID YOU KNOW?

Date: |

Should I buy bitcoin?

“To the extent it is used I fear it’s often for illicit finance. It’s an extremely inefficient way of conducting transactions, and the amount of energy that’s consumed in processing those transactions is staggering,” the former Fed chairwoman said. Yellen’s comments have been cited as a reason for bitcoin’s recent losses. However, Yellen’s assessment of bitcoin as a inefficient medium of exchange is an important point and one that has already been raised in the past by bitcoin bulls. Using a volatile asset in exchange for goods and services makes little sense if the asset can tumble 10% in a day, or surge 80% over the course of a two months as bitcoin has done in 2021, critics argue. To put a finer point on it, over the past 12 months bitcoin has registered 8 corrections, defined as a decline from a recent peak of at least 10% but not more than 20%, and two bear markets, which are defined as falls of 20% or more, according to Dow Jones Market Data.

RISC V Reddit from us


Telegram RISC-V Reddit
FROM USA